package com.wd.base.mvvm;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * NA<BR>
 *
 * @author w4425
 * @version [V5.9.3, 2021/6/9]
 * @since V5.9.3
 */
public abstract class BaseView extends FrameLayout {
    private View view;

    public BaseView(@NonNull Context context) {
        super(context);
        init(context);
    }

    public BaseView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public BaseView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    public void init(Context context) {
        view = LayoutInflater.from(context).inflate(getLayoutId(), this);
        initView(view);
    }

    protected abstract int getLayoutId();

    protected abstract void initView(View view);

    public abstract void loadData();
}
